<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/10/7
 * Time: 22:14
 */
header("Content-type:text/html;charset=utf-8");
//定义变量$name保存学生的名字
$name ="小红";
//定义变量$score保存学生的分数
$score =78;
//判断$score是否为一个有效数值
if(is_int($score)||is_float($score)) {
    //根据分数所在区间，显示相应的得分等级。
    if ($score >= 90 && $score <= 100) {
        $str = "A级";//用于保存成绩判断信息
    } elseif ($score >= 80 && $score <= 90) {
        $str = "B级";
    } elseif ($score >= 70 && $score <= 80) {
        $str = "C级";
    } elseif ($score >= 60 && $score <= 70) {
        $str = "D级";
    } elseif ($score >= 0 && $score <= 60) {
        $str = "E级";
    } else {
        $str = "学生成绩范围必须在0~100!";
    }
}else{
        $str ="输入的学生成绩不是数值!";
    }

//输出成绩判断结果
echo "<h2>学生成绩等级</h2><p>学生姓名:" .$name."<p>学生分数：" .$score."<p>成绩等级:".$str;
